import request from '@/utils/axios/axios-service.ts'

/**
 * 代理级别配置
 */
export const agentConfigList = (params: any) => request.get('/agent/config/list', {params: params})
export const agentConfigInfo = (id: number) => request.get('/agent/config/info/' + id)
export const agentConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/agent/config/create' : '/agent/config/update', params)
export const agentConfigAll = () => request.get('/agent/config/all')

/**
 * 代理记录
 */
export const agentList = (params: any) => request.get('/agent/list', {params: params})
export const agentInfo = (uid: number) => request.get('/agent/info/' + uid)
export const agentSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/agent/create' : '/agent/update', params)
export const agentAudit = (params: any) => request.post('/agent/audit', params)
export const agentModifyUser = (params: any) => request.post('/agent/modify_user', params)

/**
 * 合伙人赠送接口
 */
export const partnerGiveAwayList = (params: any) => request.get('/partner/give_away/list', {params: params})
export const partnerGiveAwayAudit = (params: any) => request.post('/partner/give_away/audit', params)

/**
 * 大区代理级别配置
 */
export const bigAgentConfigList = (params: any) => request.get('/big_agent/config/list', {params: params})
export const bigAgentConfigInfo = (id: number) => request.get('/big_agent/config/info/' + id)
export const bigAgentConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/big_agent/config/create' : '/big_agent/config/update', params)
export const bigAgentConfigAll = () => request.get('/big_agent/config/all')

/**
 * 大区代理记录
 */
export const bigAgentList = (params: any) => request.get('/big_agent/list', {params: params})
export const bigAgentInfo = (uid: number) => request.get('/big_agent/info/' + uid)
export const bigAgentSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/big_agent/create' : '/big_agent/update', params)
export const bigAgentAudit = (params: any) => request.post('/big_agent/audit', params)

export type RegionAgentConfig = {
  id: number;
  open: boolean;
  name: string;
  level: number;
  icon: string;
  background: string;
  text_color: string;
  bonus_ratio: number;
  bonus_ratio_store: number;
  bonus_ratio_service: number;
  bonus_ratio_service_store: number;
  bonus_ratio_withdraw: number;
  partner_quota: number;
};

export type RegionAgent = {
  id: number;
  status: number;
  user_id: number;
  name: string;
  identity_card_no: string;
  contact_phone: string;
  level: number;
  region_code: number;
  region_name: string;
  region_full_name: string;
  expire_time: string;
  audit_time: string;
  audit_opinion: string
  account: string;
};

export type BigRegionAgentConfig = {
  id: number;
  open: boolean;
  name: string;
  region_codes: string;
  region_name: string;
  icon: string;
  background: string;
  text_color: string;
  bonus_ratio: number;
  bonus_ratio_store: number;
  bonus_ratio_service: number;
  bonus_ratio_service_store: number;
  bonus_ratio_withdraw: number;
};

export type BigRegionAgent = {
  id: number;
  status: number;
  user_id: number;
  name: string;
  identity_card_no: string;
  contact_phone: string;
  config_id: number;
  audit_time: string;
  audit_opinion: string
  account: string;
};
